from django.contrib import admin
from .models import *


# Register your models here.
# 继承自modeladmin
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title', 'desc', 'click_count',)
    list_display_links = ('title', 'desc',)
    list_editable = ('click_count',)

    fieldsets = (
        (None, {
            'fields': ('title', 'desc', 'content', 'user', 'category', 'tag',)
        }),
        ('高级设置', {
            'classes': ('collapse',),
            'fields': ('click_count', 'is_recommend',)
        }),
    )

    class Media:

        js = (
            '/static/js/kindeditor/kindeditor-all-min.js',  # 核心文件
            '/static/js/kindeditor/lang/zh-CN.js',  # 语言文件
            '/static/js/kindeditor/config.js',  # 配置文件
        )


admin.site.register(User)
admin.site.register(Tag)
admin.site.register(Article, ArticleAdmin)
admin.site.register(Category)
admin.site.register(Comment)
admin.site.register(Links)
admin.site.register(Ad)
